/*
 * Copyright (C) 2025 Tsingteng MicroSystem
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#ifndef _NFA_WIREDSE_API_H_
#define _NFA_WIREDSE_API_H_
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "nfa_base.h"

#define HCI_EVT_ATR_LEN (15)

typedef struct {
    uint16_t len;
    uint8_t *data;
} tAPDU;

/**
 * @brief 发送apdu abort请求
 * @param atr 存放获取到的ATR的指针
 * @return 成功时返回NCI_STATUS_OK
 */
tNCI_STATUS nfa_wiredse_abort(void);

/**
 * @brief 获取ATR内容
 * @note 从缓存里面获取最近一次的ATR的内容（不会真正执行get ATR)
 *       调用者需要提供一个长度至少为HCI_EVT_ATR_LEN的buf
 * @param atr 用于存放ATR结果的指针
 * @return 成功时返回NCI_STATUS_OK
 */
tNCI_STATUS nfa_wiredse_get_atr(tAPDU atr);

/**
 * @brief 发送end apdu请求
 * @note end apdu操作不会有返回值，指令发送成功即认为执行成功
 * @return 成功时返回NCI_STATUS_OK
 */
tNCI_STATUS nfa_wiredse_end_apdu(void);

/**
 * @brief 发送APDU请求
 * @note 执行成功时由调用者释放rapdu->data内存
 * @param capdu 需要发送的APDU
 * @param rapdu 用于存放rAPDU的指针
 * @return 成功时返回NCI_STATUS_OK
 */
tNCI_STATUS nfa_wiredse_send_apdu(tAPDU capdu, tAPDU *rapdu);

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
